home *** CD-ROM | disk | FTP | other *** search
/ HaCKeRz Kr0nlcKLeZ 1 / HaCKeRz Kr0nlcKLeZ.iso / chibacity / tdupdat2.err / MASUDKHA.ZIP / TPE11.ZIP / TPE.DOC < prev    next >
Encoding:
Text File  |  1993-12-24  |  8.4 KB  |  218 lines

  1.  
  2.  
  3.         TridenT Polymorphic Engine                       version 1.1
  4.         ============================================================
  5.  
  6.         Written by Masud Khafir of the TridenT virus research group.
  7.  
  8.  
  9.  
  10. What is it?
  11. ~~~~~~~~~~~
  12.  
  13.         The TPE is a module that can be included in programs to make
  14.         them able to produce polymorphic programs. The TPE comes as
  15.         an OBJ file. If you want to include the TPE in your program
  16.         you must link it to it. If you have never linked an object
  17.         file to a program, DON'T start with the TPE. First do this,
  18.         then return to the TPE.
  19.  
  20.         The TPE does two things. First, it will encrypt the original
  21.         code. This is done in a different way each time the TPE is
  22.         called. Second, it will generate a decryption routine for it.
  23.         The encrypted code will be put right after the decryption
  24.         routine. The size of the decryption routine will not be very
  25.         big. At most a few hundred bytes. Of course, the decryptor
  26.         will also be different each time the TPE is called. The TPE
  27.         can produce plain decryptors or decryptors with some random
  28.         non-functional instructions inserted.
  29.  
  30.         The size of the TPE is 1378 bytes; We believe this is not too
  31.         big.
  32.  
  33.  
  34.  
  35. How can I use it?
  36. ~~~~~~~~~~~~~~~~~
  37.  
  38.         The TPE offers you 3 subroutines: 'rnd_init', 'rnd_get' and
  39.         'crypt'. It also can give you the addresses of the begin and
  40.         end of TPE. If you write your program in assembler, you must
  41.         include the following in your source code:
  42.  
  43.                 .model  tiny
  44.                 .code
  45.  
  46.                 extrn   rnd_init:near
  47.                 extrn   rnd_get:near
  48.                 extrn   crypt:near
  49.                 extrn   tpe_bottom:near
  50.                 extrn   tpe_top:near
  51.  
  52.         The first (rnd_init) is a subroutine to initialize the random
  53.         number generator. You are advised to call this subroutine
  54.         before the first time you call the encryption subroutine. If
  55.         you don't, the random number generator may not function
  56.         perfectly. All registers will be preserved.
  57.  
  58.         The second is a subroutine that returns a random number in AX.
  59.         This subroutine is used by TPE, but you can use it also for
  60.         other things in your program. Your imagination is the limit.
  61.         All registers, except AX, are preserved.
  62.  
  63.         The third is the actual encryption subroutine. This one needs
  64.         several input parameters. When it finishes, it will return
  65.         some output parameters. All parameters are passed in registers
  66.         (see below).
  67.  
  68.         The last two are the begin and end addresses of the TPE in
  69.         your program. You may need these if your program is going to
  70.         include the TPE in the generated program.
  71.  
  72.         You can leave out 'extrn' commands of things you don't use
  73.         in your source code. 
  74.  
  75.         Be sure that there is enough stack space for the TPE. (100
  76.         bytes appear to be enough). If you use the TPE in a resident
  77.         program, it is recomended to maintain your own stack.
  78.         Otherwise the chance is that you will blow the DOS stack.
  79.  
  80.         Of course, you must link TPE.OBJ to you program!
  81.         If you are using more than one segment in your program, the
  82.         complete TPE will be put in the CODE segment (called _TEXT). 
  83.  
  84.  
  85.  
  86. Input parameters of the crypt routine:
  87. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  88.  
  89.         ES = Work segment
  90.  
  91.             This is the place where the decryptor and the encrypted
  92.             code will be generated. Be sure that it is large enough.
  93.             It must at least be as large as the size of the code to
  94.             encrypt plus the size of the decryptor. 512 bytes plus
  95.             the length of the code ought to be enough.
  96.  
  97.         DS:DX => Code to encrypt
  98.  
  99.             This must point to the code you want to encrypt.
  100.  
  101.         CX = Length of code to encrypt
  102.  
  103.             Put the size of the piece of code you want to encrypt
  104.             in CX.
  105.  
  106.         BP = Offset where the decryption routine will be executed
  107.  
  108.             You must put the address where the decryptor will start
  109.             in BP. For example, if the generated program will be a
  110.             COM file which starts with the decryptor, you must set
  111.             this value to 100h.
  112.  
  113.         SI = Distance between decryptor and encrypted code
  114.  
  115.             In this register you must put the distance that will be
  116.             between the decryptor and the encrypted code. If the
  117.             encrypted code will be right after the decryptor (this
  118.             is the normal case) you must set this value to 0.
  119.  
  120.         AX = Bit field
  121.  
  122.             In this register you can provide some options about the
  123.             way the decryptor must be.
  124.  
  125.             bit 0:  DS will not always be equal to CS
  126.  
  127.                 If you are not sure that DS will be equal to CS when
  128.                 the decryptor takes control, you must set this bit
  129.                 high. This is the case when the decryptor is in an
  130.                 EXE file.
  131.  
  132.             bit 1:  Insert random non-functional instructions in 
  133.                     decryptor
  134.  
  135.                 If this bit is high, the decryption routine will
  136.                 contain several non-functional instructions. Since
  137.                 these instructions are non-functional, they don't
  138.                 disturb the decryptor.
  139.  
  140.             bit 2:  Put random instructions before decryptor
  141.  
  142.                 If this bit is high, several random instructions
  143.                 are put before the decryption routine. These
  144.                 instructions may affect the registers, but they
  145.                 won't disturb the decryptor.
  146.  
  147.             bit 3:  Preserve AX with decryptor
  148.  
  149.                 If you want to preserve the original value of AX
  150.                 after decryption, you must set this bit high.
  151.  
  152.  
  153.  
  154. Output parameters of the crypt routine:
  155. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  156.  
  157.         ES = Work segment (preserved)
  158.  
  159.             ES will still point to the work segment.
  160.  
  161.         DS:DX => Decryptor + encrypted code
  162.  
  163.             This will now point to the decryptor, immediatly followed
  164.             by the encrypted code. DS:DX will be the same as ES:0000.
  165.             If SI was set to 0 before the TPE was called, the code
  166.             is now ready to be put in a file.
  167.  
  168.         CX = Length of decryptor + encrypted code
  169.  
  170.             CX now has the summary length of both the decryptor and
  171.             the encrypted code. You can use this value to write the
  172.             decryptor plus the encrypted code to a file (in case SI
  173.             was set to 0 before the TPE was called).
  174.  
  175.         DI = Length of decryptor
  176.  
  177.             If SI was not set to 0 before the TPE was called, you
  178.             will need this value when you want to write the decryptor
  179.             to a file. This value can also be used as an offset of
  180.             the encrypted code. This will be at DS:DI (because DX
  181.             will be 0). If SI was 0, you can ignore this value.
  182.  
  183.         AX = length of encrypted code
  184.  
  185.             This value will be the same as the value of CX before
  186.             the TPE was called. If SI was not set to 0 before the
  187.             TPE was called, you will need this value when you want
  188.             to write the encrypted code to a file. If SI was 0, you
  189.             can ignore this value.
  190.  
  191.         BP = Offset where the decryption routine will be (preserved)
  192.  
  193.             BP will still contain the address from where the
  194.             decryption routine must be executed.
  195.  
  196.  
  197.  
  198. Final notes.
  199. ~~~~~~~~~~~~
  200.  
  201.         First, I want to thank the Dark Avenger from Bulgaria for his
  202.         nice 'Mutation Engine' program. This fine program has been a
  203.         great source of inspiration for the TPE!
  204.  
  205.         Check out the source of TPE-GEN to learn more about the TPE
  206.         and how it works.
  207.  
  208.         Please, remember that the author of the TPE and the TridenT
  209.         virus research group are not responsible if you use the TPE
  210.         in an illegal or naughty way.        
  211.  
  212.         Good luck.
  213. 
  214. ;  ─────────────────────────────────────────────────────────────────────────
  215. ;  ───────────────> ReMeMbEr WhErE YoU sAw ThIs pHile fIrSt <───────────────
  216. ;  ───────────> ArReStEd DeVeLoPmEnT +31.77.SeCrEt H/p/A/v/AV/? <───────────
  217. ;  ─────────────────────────────────────────────────────────────────────────
  218.